<%--
  Created by IntelliJ IDEA.
  User: fire'ge
  Date: 2022/4/4
  Time: 14:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>店铺大全</title>
    <link rel="stylesheet" href="/TakeawaySystem/css/Show.css" type="text/css">
</head>
<body>
<div>
    <table id="name-label">
        <tr>
            <td align="center" colspan="4">你好！${user.username}<c:if test="${user == null}">游客</c:if>
                <a href="/TakeawaySystem/jsp/UserCenter.jsp">返回</a>  </td>
        </tr>
    </table>
    <table>
        <tr>
            <td id= "tableTopic">
                商  店  大  全
            </td>
        </tr>
        <c:forEach items="${shops}" var="shop">
            <tr>
                <td class="shopTopic">
                    <a href="/TakeawaySystem/user/showMenu?shopId=${shop.id}">
                            ${shop.shopName}
                    </a>
                </td>
                <td>
                    点赞数：${shop.star}
                </td>
            </tr>
            <tr>
                <td class="description">
                    描述：${shop.description}
                </td>
                <td class="description">
                    <a href="addShopStar?shopId=${shop.id}">点赞</a>
                </td>
                <td class="description">
                    <a href="addCollect?shopId=${shop.id}">收藏</a>
                </td>
            </tr>
        </c:forEach>
        <tr>
            <td>共 ${rows} 条
             第
                <c:forEach begin="0" end="${rows/9}" var="page" step="1">
                    <a href="/TakeawaySystem/user/showShop?start=${page*9}">${page+1}</a>
                </c:forEach>
                页

        </tr>

    </table>
</div>
</body>
<Script Language="JavaScript">
    let cart = document.getElementById("cart");
    cart.onclick = addCart;
    function addCart()
    {
        document.getElementById("bookForm").action="user/addCart";
        document.getElementById("bookForm").submit();
    }

</Script>
</html>
